package it.basilikos.core.model;

import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToOne;
import javax.persistence.PersistenceContext;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

@Entity
@PersistenceContext
@Table(name="product_conferred")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorValue("conferred")
public class ProductConferred extends Product {	
	
	private static final long serialVersionUID = -8401066053339280611L;
	
	@OneToOne(fetch=FetchType.LAZY)
	@NotNull
//	@JoinColumn(name="products_conferred_id",referencedColumnName="id",insertable=false,updatable=false)
	private Conferment conferment;

	public ProductConferred(Conferment conferment)
	{
		super();
		this.conferment = conferment;
	}
	
	public ProductConferred()
	{
		super();
	}
	
	@Override
	public String toString() {
		return "ProductConferred [ id=" + id + " fruit = "+getFruit()+" ]";
	}
	
	
	public Conferment getConferment() {
		return conferment;
	}
	
	public void setConferment(Conferment conferment) {
		this.conferment = conferment;
	}
	
	
	
	
}
